package com.yanqu.road.server.cmd.activity.commonteam;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.exception.BusinessException;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.CommonGuessProto;
import com.yanqu.road.pb.activity.CommonTeamProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.CmdApi;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.guess.CommonGuessModule;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.commonteam.CommonTeamMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@CmdApi(reqMsg = CommonTeamProto.CommonTeamGetTeamListReqMsg.class, respMsg = CommonTeamProto.CommonTeamGetTeamListRespMsg.class)
@Cmd(code = Protocol.S_COMMON_TEAM_GET_TEAM_LIST,desc = "通用组队-获取队列表")
public class CommonTeamGetTeamListCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        CommonTeamProto.CommonTeamGetTeamListReqMsg reqMsg = CommonTeamProto.CommonTeamGetTeamListReqMsg.parseFrom(packet.getBytes());
        try {
            CommonTeamMgr.getTeamList(player, reqMsg);
        } catch (BusinessException e) {
            CommonTeamProto.CommonTeamGetTeamListRespMsg.Builder respMsg = CommonTeamProto.CommonTeamGetTeamListRespMsg.newBuilder();
            respMsg.setRet(e.getCode());
            player.sendPacket(Protocol.U_COMMON_TEAM_GET_TEAM_LIST, respMsg);
        }
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
